<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <h3>整体思路：服务器在给出响应时，通过添加Access-Control-Allow-Origin响应头，来明确表达允许某个源发起跨域请求，随后浏览器在校验时，直接通过。</h3>
    <button id="btn" onclick="showDOM()"> 获取数据</button>
    <script type="text/javascript">

        async function showDOM() {
            const url = 'http://192.168.1.122:8081'
            let result = await fetch(url)
            let data = await result.json();
            console.log(data)
        }

    </script>
</body>

</html>